<extend name="Layout:layout"/>

<block name="css">
	<link rel="stylesheet" href="">
</block>

<block name="srcjs">
	<script type="text/javascript" src=""></script>
</block>

<block name="content">
    <h3>注册申请</h3>
    <hr>
    <table id="aplLearnerTable" class="table table-hover table-condensed">
        <thead>
            <tr>
                <th>序号</th>
                <th>员工编号</th>
                <th>真实姓名</th>
                <th>电话</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            
            <volist name="aplLearners" id="learner" key="k">
                <tr>
                    <td>{$k}</td>
                    <td>{$learner.username}</td>
                    <td>{$learner.real_name}</td>
                    <td>{$learner.tel}</td>
                    <td>{$learner.create_time}</td>
                    <td>
                        <button
                            type="button"
                            class="btn btn-success btn-xs"
                            data-name="btnApprove" 
                            data-learner-id="{$learner.id}"
                        >
                            通过
                        </button>
                        <button 
                            type="button" 
                            class="btn btn-danger btn-xs"
                            data-name="btnLearnerDel"
                            data-learner-id="{$learner.id}"
                        >
                            删除
                        </button>
                        <!--<button type="button" class="btn btn-default btn-xs">重置密码</button>-->
                    </td>
                </tr>
            </volist>

            
        </tbody>
    </table>
    
    <hr>
    
    <h3>重置密码申请</h3>
    <hr>
    <table id="fpwdLearnerTable" class="table table-hover table-condensed">
        <thead>
            <tr>
                <th>序号</th>
                <th>登录名</th>
                <th>真实姓名</th>
                <th>电话</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            
            <volist name="fpwdLearners" id="learner" key="k">
                <tr>
                    <td>{$k}</td>
                    <td>{$learner.username}</td>
                    <td>{$learner.real_name}</td>
                    <td>{$learner.tel}</td>
                    <td>{$learner.create_time}</td>
                    <td>
                        <button 
                            type="button"
                            class="btn btn-default btn-xs"
                            data-name="btnResetPwd" 
                            data-learner-id="{$learner.id}"
                        >
                            重置</button>
                        <button 
                            type="button"
                            class="btn btn-default btn-xs"
                            data-name="btnCancelPwd" 
                            data-learner-id="{$learner.id}"
                        >
                            取消
                        </button>
                    </td>
                </tr>
            </volist>

            
        </tbody>
    </table>
    
</block>

<block name="customjs">
    <script>
        $(function(){
            
            
            
            $("#aplLearnerTable").delegate("[data-name='btnApprove']", "click", function () {
                var id = $(this).attr("data-learner-id");
                var sendData = {
                    "id" : id
                };
                $.post("{:U('runApprove')}",sendData).done(function(responseData){
                    if (responseData.status === 1) {
                        location.href = responseData.jumpUrl;
                    } else {
                        alert(responseData.info);
                    }
                });
            });
            
            
            $("#aplLearnerTable").delegate("[data-name='btnLearnerDel']", "click", function () {
                var id = $(this).attr("data-learner-id");
                var sendData = {
                    "id" : id
                };
                
                if(confirm("确认要删除吗？")){
                    $.post("{:U('runLearnerDel')}",sendData).done(function(responseData){
                        if (responseData.status === 1) {
                            location.href = responseData.jumpUrl;
                        } else {
                            alert(responseData.info);
                        }
                    });
                }
                
            });
            
            
            
            
            $("#fpwdLearnerTable").delegate("[data-name='btnResetPwd']", "click", function () {
                var id = $(this).attr("data-learner-id");
                var sendData = {
                    "id" : id
                };
                
                if(confirm("是否要重置密码？")){
                    $.post("{:U('runResetPwd')}",sendData).done(function(responseData){
                        if (responseData.status === 1 || responseData.status === 2) {
                            alert(responseData.info);
                            location.href = responseData.jumpUrl;
                        } else {
                            alert(responseData.info);
                        }
                    });
                }
                
            });
            
            
            $("#fpwdLearnerTable").delegate("[data-name='btnCancelPwd']", "click", function () {
                var id = $(this).attr("data-learner-id");
                var sendData = {
                    "id" : id
                };
                

                $.post("{:U('runCancelPwd')}",sendData).done(function(responseData){
                    if (responseData.status === 1) {
                        alert(responseData.info);
                        location.href = responseData.jumpUrl;
                    } else {
                        alert(responseData.info);
                    }
                });
                
            });
          
        });
    </script>
</block>
